<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/7/22
 * Time: 15:54
 */

namespace app\service;


use Redis\Redis;

class ScrollborderService
{
    function __construct()
    {
    }

    /**
     * @return array
     * @context 滚动轮播消息列表
     */
    function scroll_list()
    {
        $redis = new Redis();
        $list = $redis->lRanges("scroll", 0, -1);
        if (!empty($list)) {
            return array("status" => true, "data" => $list);
        } else {
            return array("status" => false);
        }
    }

    /**
     * @param $param    一维数组 ['xxxx获得了xxx']
     * @return bool
     * @context 滚动轮播添加
     */
    function scroll_add($param)
    {
        $redis = new Redis();
        $_time = 300;
        foreach ($param as $k => $v) {
            $redis->rPush("scroll", $v, $_time);
        }
        return true;
    }

}